#ifndef SERVER_H
#define SERVER_H

#include "autoload.h"

class Server: public QTcpServer {
    Q_OBJECT

public:
    bool start(int port);
    void stop();
    Server(QObject* parent = 0);
    ~Server();
    void processRequest(QString xml, QTcpSocket *client);

protected slots:
    void incomingConnection(int socketDescriptor);

private slots:
    void readyRead();
    void disconnected();

private:
    QSet<QTcpSocket*> clients;
    QMap<QTcpSocket*, QString> users;
    QMap<QString, ServerCommand*> commands;


};

#endif // SERVER_H
